package com.sf.fy.uav.controller;

import com.sf.fy.uav.common.request.common.IdRequest;
import com.sf.fy.uav.common.request.operate.SysBannerRequest;
import com.sf.fy.uav.common.request.operate.SysNoticeRequest;
import com.sf.fy.uav.common.request.order.DealRequest;
import com.sf.fy.uav.common.response.operational.BannerResponse;
import com.sf.fy.uav.common.response.operational.SysBannerResponse;
import com.sf.fy.uav.common.response.operational.SysNoticeResponse;
import com.sf.fy.uav.entity.Notice;
import com.sf.fy.uav.service.INoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2024-08-08
 */
@RestController
@RequestMapping("/applet/notice")
public class NoticeRest {

    @Autowired
    private INoticeService iNoticeService;

    @GetMapping
    public List<Notice> getNotice() {
        return iNoticeService.getNotice();
    }


    public Long getTotal(@RequestParam(required = false) String name, @RequestParam(required = false) Integer status) {
        return iNoticeService.getTotal(name, status);
    }

    public List<SysNoticeResponse> getNotices(SysNoticeRequest sysNoticeRequest) {
        return iNoticeService.getNotices(sysNoticeRequest);
    }


    public void off(@RequestBody DealRequest dealRequest) {
        iNoticeService.off(dealRequest);
    }

    public Integer start(@RequestBody IdRequest idRequest) {
        return iNoticeService.start(idRequest);
    }

    public Integer end(@RequestBody IdRequest idRequest) {
        return iNoticeService.end(idRequest);
    }

    public void delete(@RequestBody DealRequest dealRequest) {
        iNoticeService.delete(dealRequest);
    }

    public SysNoticeResponse getById(@RequestParam String bannerId) {
        return iNoticeService.getById(bannerId);
    }


    public List<Notice> selectNotStartAndIng(Date startTime, Date endTime, String id) {
        return iNoticeService.selectNotStartAndIng(startTime, endTime, id);
    }
}
